package com.gz.rocketmq.producer;

import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.common.message.Message;

public class OneWayProducer {

    public static void main(String[] args) {
        DefaultMQProducer producer = new DefaultMQProducer("rocketmq03");
        int messageCount = 5;
        try {
            producer.setNamesrvAddr("192.168.36.128:9876");
            producer.start();
            for (int i = 0; i < messageCount; i++) {
                Message message = new Message();
                message.setTopic("topic03");
                message.setTags("tag02");
                message.setBody((i + "-Hello02").getBytes());
                producer.sendOneway(message);
            }
        } catch (Exception e) {

        }
        producer.shutdown();
    }

}
